{extend name="public/base"/}
{block name="body"}
<title>公司简介</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>关于我们<span class="c-gray en">&gt;</span> 公司简介<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
		<div class="section">
			<section>
				<form class="form form-horizontal" id="form-admin-add">
					<input type="hidden" class="input-text" value="{$data.id}" id="id" name="id">
					<div class="row cl">
						<label class="form-label col-xs-3 col-sm-2">SEO关键词：</label>
						<div class="formControls col-xs-8 col-sm-9">
							<input type="text" class="input-text" value="{$data.seo_keywords}" id="seo_keywords" name="seo_keywords">
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-xs-3 col-sm-2">SEO描述：</label>
						<div class="formControls col-xs-8 col-sm-9">
							<input type="text" class="input-text" value="{$data.seo_description}" id="seo_description" name="seo_description">
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-xs-3 col-sm-2">标题：</label>
						<div class="formControls col-xs-8 col-sm-9">
							<input type="text" class="input-text" value="{$data.title}" id="title" name="title">
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-xs-3 col-sm-2">副标题：</label>
						<div class="formControls col-xs-8 col-sm-9">
							<input type="text" class="input-text" value="{$data.subtitle}" id="subtitle" name="subtitle">
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-xs-3 col-sm-2">简介：</label>
						<div class="formControls col-xs-8 col-sm-9">
							<textarea rows="6" style="width:100%" name="introduce">{$data.introduce}</textarea>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-xs-3 col-sm-2">发展数据：</label>
						<div class="formControls col-xs-8 col-sm-9" id="add_info">
							<a id="add_info_btn" class="btn btn-primary">+属性标签</a>
							{volist name="data['intro_item']" id="value" key="kk"}
							<div class="attrs">
								<input type="text" class="attrname" value="{$value->attrname}" placeholder="属性名,例:专利" id="attrname{$kk-1}" name="attrname{$kk-1}">：
								<input type="text" class="attrval" value="{$value->attrval}" placeholder="属性值,例:23" id="attrval{$kk-1}" name="attrval{$kk-1}">
							</div>
							{/volist}
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-xs-3 col-sm-2">详情：</label>
						<div class="formControls col-xs-8 col-sm-9">
							<script id="editor" name="detail" type="text/plain" style="width:100%;height:400px;">{:htmlspecialchars_decode($data.detail)}</script>
						</div>
					</div>
					<div class="row cl">
						<div class="col-xs-8 col-sm-9 col-xs-offset-3 col-sm-offset-2">
							<input id="submit" class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
						</div>
					</div>
				</form>
			</section>
		</div>
		
</article>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/public/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/public/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/public/static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/public/static/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="/public/static/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="/public/static/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
var ii="{if $data.intro_item}{:count($data.intro_item)}{else}0{/if}";
$(function(){
	var ue = UE.getEditor('editor');
    $('#add_info_btn').click(function(){
    	if(ii<4){
	    	var attrn='<div class="attrs">'+
						'<input type="text" class="attrname" value="" placeholder="属性名,例:拥有车辆100余台" id="attrname'+ii+'" name="attrname'+ii+'">：'+
						'<input type="text" class="attrval" value="" placeholder="属性值,例:100" id="attrval'+ii+'" name="attrval'+ii+'">'+
					'</div>'
			$("#add_info").append(attrn);
			ii++;
		}else{
			layer.msg('属性不能太多',{icon:2,time:3000});
		}
    });
});
$("#submit").click(function() {
	layer.load(1, {
	  shade: [0.1,'#fff'] //0.1透明度的白色背景
	});
	var attrarrs=new Array();
	for(var n=0;n<ii;n++){
		var attrname=$("input[name=attrname"+n+"]").val();
		var attrval=$("input[name=attrval"+n+"]").val();
		var attrarr={attrname:attrname,attrval:attrval};
		attrarrs.push(attrarr);
	}
	var seo_keywords=$("input[name=seo_keywords]").val();
	var seo_description=$("input[name=seo_description]").val();
	var title=$("input[name=title]").val();
	var subtitle=$("input[name=subtitle]").val();
	var introduce=$("textarea[name=introduce]").val();
	var detail=UE.getEditor('editor').getContent();
	$.ajax({
	    type: 'POST',
	    url: "{:url('introduce')}",
	    data: {title:title,subtitle:subtitle,introduce:introduce,detail:detail,intro_item:attrarrs,seo_description:seo_description,seo_keywords:seo_keywords},
	    success: function(resdata){
	        if(resdata.code==200){
				layer.msg(resdata.msg,{icon:1,time:1000});
				setTimeout("location.reload()",1000);
	        }else{
				layer.msg(resdata.msg,{icon:2,time:3000});
	        }
	    },
	    error: function(){
			layer.msg('数据保存失败',{icon:2,time:3000});
	    }
	})
    
})
</script> 

{/block}